<?php 
	include_once '../../include/inc_session.php';

	$_SESSION['produit'] = intval($_POST['val_sel']);

	//$_SESSION['idcontrat_old']  = $_GET['id'];
	$sDateRenew = $_GET['d'];
	
	$oFormule = new dataObject_formule();
	$oProd = new dataObject_produit($_SESSION['produit']);
	$idOffre = $oProd->_IDENTIFIANT_OFFRE;
	$asFormule = $oFormule->formule_getListFormuleOuvert($_SESSION['produit'], $sDateRenew);
	
	// construction de la liste deroulante
	$aff  = "";
	$var1 = "";
	$var  = "";
	
	$aff = "<select name='OFM_formule' id='cont_list3' onFocus=\"makeRequest('rep_ajaxphp2.php?id1=".$_POST['val_sel']."&id2=".$idOffre."','cont_list3','id_list4')\"  onChange=\"makeRequest('rep_ajaxphp2.php?id1=".$_POST['val_sel']."&id2=".$idOffre."','cont_list3','id_list4')\">
			<option ".$var1.">-- Choisissez --</option>";
	
	foreach($asFormule as $iKey => $aRow)
	{
		$_SESSION['produit'] = $_POST['val_sel'];
		if( isset($_SESSION['formule']) && $aRow['Identifiant_formule']== $_SESSION['formule'])
			$var="selected='selected'";
		else
		 	$var1="selected='selected'";
		 	
		$aff.="<option  ".$var."value=\"".$aRow['Identifiant_formule']."\">".$aRow['Libelle_formule']."</option>"; 
	}
	$aff = $aff."</select>";

	// envoi reponse Php a Ajax	
	echo $aff;
	
	include_once PATH_INCLUDE.'inc_pied_page.php';
?>
